/*
 * @Author: your name
 * @Date: 2020-10-13 18:05:14
 * @LastEditTime: 2021-01-20 11:33:04
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \jiangxi_postal_web\src\apis\jxyzwg.js
 */
/*
 * 接口请求封装, xVue中 axios的拦截器是公用的,在这里重新封装
 * @param method
 * @param url
 * @param params
 * @param data
 * @returns {Promise<unknown>}
 */
function request ({
    method = 'get',
    url,
    params,
    data
}) {
    console.log('请求参数 >>> ', url)
    return new Promise(resolve => {
        window._xvueAxios({
            method,
            url,
            params,
            data,
        }).then(res => {
            const resData = res.data;
            if (resData.code === 0) {
                resolve(resData)
            } else {
                resolve(resData)
            }
        }).catch(err => {
            resolve(err);
        });
    })
}
export default {
    /**
     * 查询营业部员工月计划信息列表
     * @param params
     */
    getMonthPlanList (params) {
        return request({
            method: 'get',
            url: `/jxyzwg/monthPlan/plans`,
            params,
        });
    },
    /**
     * 新增月计划信息
     * @param params
     */
    addMonthPlan (data) {
        return request({
            method: 'post',
            url: `/jxyzwg/monthPlan/plans`,
            data,
        });
    },
    /**
     * 更新月计划信息
     * @param params
     */
    eidtMonthPlan (data) {
        return request({
            method: 'PUT',
            url: `/jxyzwg/monthPlan/plans`,
            data,
        });
    },
    /**
    * 批量新增月计划信息
    * @param params
    */
    batchMonthPlan (data) {
        return request({
            method: 'POST',
            url: `/jxyzwg/monthPlan/plans/batch`,
            data,
        });
    },

    /**
    * 日收入表 excel下载
    * @param params
    */
    incomeDownload (params) {
        return request({
            method: 'get',
            url: `/jxyzwg/income/summarys/download`,
            params,
        });
    },
    /**
     * 查询营业部日收入汇总列表
     * @param params
     */
    getIncomeList (params) {
        return request({
            method: 'get',
            url: `/jxyzwg/income/summarys`,
            params,
        });
    },
    /**
    * 查询营业部日收入汇总列表
    * @param params
    */
    getDateList (params) {
        return request({
            method: 'get',
            url: `/jxyzwg/income/summarys/date`,
            params,
        });
    },
    /**
    * 获取ADO当前用户的组织数据
    * @param params
    */
    getOrgList (params) {
        return request({
            method: 'get',
            url: `/jxyzwg/org/getOrgList`,
            params,
        });
    },
    /**
     * 段道与营业部员工信息导出
     * 导出
     */
    exportExcel () {
        return `http://10.39.84.131:8085/jxyzwg/department/exportExcel`
    },

    /**
     * 更新员工填报信息
     * @param params
     */
    eidtHistory (data) {
        return request({
            method: 'PUT',
            url: `/jxyzwg/income/dailyIncomes/history`,
            data,
        });
    },
    /**
   * 7. 根据编码查询城市维度
   * @param data
   */
  getDepartmentListByCode(data) {
 
    return request({
      method: 'post',
      url: `/jxyzwg/oneClickResponse/getDepartmentListByCode`,
      data,
    });
  },
};